export * from './timer'
export * from './simple-cache'
export * from './ring-buffer'

export function keyGen(prefix: string) {
  let idx = 1
  const next = () => {
    const ret = `${prefix}${idx}`
    idx++
    return ret
  }
  return { next }
}

export function closeWindow() {
  const userAgent = navigator.userAgent
  if (userAgent.indexOf('Firefox') != -1 || userAgent.indexOf('Chrome') != -1) {
    window.location.href = 'about:blank'
    window.close()
  } else {
    window.opener = null
    window.open('', '_self')
    window.close()
  }

  // const w = window.open('', '_blank', '')
  // w?.close()
}
